/*
 * Copyright (c) 2018-2019 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#define EVENT_OVERHEAD_XTAL_US        1500
#define EVENT_OVERHEAD_PREEMPT_US     0    /* if <= min, then dynamic preempt */
#define EVENT_OVERHEAD_PREEMPT_MIN_US 0
#define EVENT_OVERHEAD_PREEMPT_MAX_US EVENT_OVERHEAD_XTAL_US
#define EVENT_OVERHEAD_START_US       300
/* Worst-case time margin needed after event end-time in the air
 * (done/preempt race margin + power-down/chain delay)
 */
#define EVENT_OVERHEAD_END_US         40
#define EVENT_JITTER_US               16
/* Ticker resolution margin
 * Needed due to the lack of fine timing resolution in ticker_start
 * and ticker_update. Set to 32 us, which is ~1 tick with 32768 Hz
 * clock.
 */
#define EVENT_TICKER_RES_MARGIN_US    32

#define EVENT_RX_JITTER_US(phy) 16    /* Radio Rx timing uncertainty */
#define EVENT_RX_TO_US(phy) ((((((phy)&0x03) + 4)<<3)/BIT((((phy)&0x3)>>1))) + \
				  EVENT_RX_JITTER_US(phy))

/* TODO - fix up numbers re. HW */
#define EVENT_RX_TX_TURNAROUND(phy)  ((phy) == 1?100:((phy) == 2 ? 80:900))

#if IS_ENABLED(CONFIG_BT_CTLR_ENABLE_ADV_SCAN_OOB_FREQ)
/** @brief Maximum allowed frequency offset
 *
 * The value is 100MHz due to max frequency value that may be used by Nordic's
 * radio: 2500MHz. That gives us offset 100MHz from carrier frequency.
 *
 * @note Maximum frequency that is allowed for BT is 2483MHz that includes
 * guard band. Last channel is 2480MHz. If you use frequencies higher than
 * 2483MHz you may violate restrictions about frequencies allocations in some
 * states.
 */
#define LLL_VS_OOB_MAX_FREQUENCY_OFFSET 100

/** @brief Defines value that is used to mark the feature as disabled */
#define LLL_VS_FREQUENCY_OFFSET_DISABLED 0xFF
#endif /* CONFIG_BT_CTLR_ENABLE_ADV_SCAN_OOB_FREQ */
